package nsu.edu.zsq.controller.student;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import nsu.edu.zsq.bean.StuScore;
import nsu.edu.zsq.common.JsonData;
import nsu.edu.zsq.param.StuScoreParam;
import nsu.edu.zsq.service.student.ScoreInfoService;

/** 
* Description: 学生成绩信息的controller类<br>
*/
@RequestMapping("/student/score")
@Controller
public class ScoreInfoController {

    @Autowired
    private ScoreInfoService scoreInfoService;
    
    /**
     * 跳转到学生学期成绩页面，携带课程成绩信息
     * @param model
     * @return String student/score/courseScore_list.html
     */
    @RequestMapping("toCourseScore_list")
    public String toCourseScore_list(Model model) {
        List<StuScoreParam> listStuScoreParam = scoreInfoService.listStuScoreParam();
        model.addAttribute("listStuScoreParam", listStuScoreParam);
        return "student/score/courseScore_list.html";
    }
    
    /**
     * 获取学生补考课程信息
     * @return JsonData
     */
    @RequestMapping("listResitCourse")
    @ResponseBody
    public JsonData listResitCourse(Model model) {
        List<StuScore> listStuScore = scoreInfoService.listResitCourse();
        return JsonData.success(listStuScore);
    }
    
    /**
     * 获取学生重修课程信息
     * @return JsonData
     */
    @RequestMapping("listRetakeCourse")
    @ResponseBody
    public JsonData listRetakeCourse(Model model) {
        List<StuScore> listStuScore = scoreInfoService.listRetakeCourse();
        return JsonData.success(listStuScore);
    }
    
}
